package com.dousb.cloudlibrary.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dousb.cloudlibrary.model.dto.book.BookQueryRequest;
import com.dousb.cloudlibrary.model.entity.Book;
import com.dousb.cloudlibrary.model.vo.BookVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 图书表服务
 */
public interface BookService extends IService<Book> {

    /**
     * 校验数据
     *
     * @param book
     * @param add  对创建的数据进行校验
     */
    void validBook(Book book, boolean add);

    /**
     * 获取查询条件
     *
     * @param bookQueryRequest
     * @return
     */
    QueryWrapper<Book> getQueryWrapper(BookQueryRequest bookQueryRequest);

    /**
     * 获取图书表封装
     *
     * @param book
     * @param request
     * @return
     */
    BookVO getBookVO(Book book, HttpServletRequest request);

    /**
     * 分页获取图书表封装
     *
     * @param bookPage
     * @param request
     * @return
     */
    Page<BookVO> getBookVOPage(Page<Book> bookPage, HttpServletRequest request);

}
